from config import URL
import logging
class OpenAccountApi:

    def __init__(self,session):
        self.session = session

    # 实名认证接口
    def realname(self,body):
        url = URL + "/member/realname/approverealname"
        # 实现接口请求，获取响应结果
        response = self.session.post(url=url,data=body,files={"x":"y"})
        print("实名认证接口的响应体数据:{}".format(response.json()))
        # 将响应体的数据打印到日志
        logging.info("实名认证接口的响应体数据:{}".format(response.json()))
        # 封装方法的返回
        return response

    # 开户接口
    def open_account(self):
        url = URL + "/trust/trust/register"
        response = self.session.post(url=url)
        print("开户接口口的响应体数据:{}".format(response.json()))
        # 将响应体的数据打印到日志
        logging.info("开户接口的响应体数据:{}".format(response.json()))
        # 封装方法的返回
        return response

    # 第三方开户接口
    def third_open_account(self,url,form_dict):
        response = self.session.post(url=url,data=form_dict)
        # 将响应体的数据打印到日志
        logging.info("第三方开户接口的响应体数据:{}".format(response.text))
        # 封装方法的返回
        return response

